package com.zh.elec.web.actions;

import java.util.List;

import com.zh.elec.model.SellRecord;
import com.zh.elec.service.SellRecordService;
import com.zh.elec.web.actions.base.AbstractAction;

/**
 * 销售表
 * @author scy
 *
 */
public class SellRecordAction extends AbstractAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5332388220976187977L;
	private SellRecordService sellRecordService;
	private SellRecord sellRecord;
	private List<SellRecord> list;
	/**
	 * 添加
	 * @return
	 */
	public String save(){
		if(sellRecord != null){
			sellRecord = (SellRecord)sellRecordService.save(sellRecord);
			return "success";
		}
		return "add";
	}
	/**
	 * 修改
	 * @return
	 */
	public String update(){
		sellRecord = (SellRecord)sellRecordService.update(sellRecord);
		return "success";
	}
	/**
	 * 删除
	 * @return
	 */
	public String del(){
		sellRecord = (SellRecord)sellRecordService.del(sellRecord);
		return "success";
	}
	/**
	 * 查询
	 * @return
	 */
	public String find(){
		list = sellRecordService.findAll();
		return "success";
	}
	/**
	 * 根据name查询
	 * @return
	 */
	public String findByName(){
		String name = "";
		String value= "";
		List<SellRecord> list = sellRecordService.findByName(name, value);
		System.out.println(list.size());
		return "success";
	}
	
	public SellRecord getSellRecord() {
		return sellRecord;
	}
	public void setSellRecord(SellRecord sellRecord) {
		this.sellRecord = sellRecord;
	}
	public void setSellRecordService(SellRecordService sellRecordService) {
		this.sellRecordService = sellRecordService;
	}
	public List<SellRecord> getList() {
		return list;
	}
	public void setList(List<SellRecord> list) {
		this.list = list;
	}
}
